//
//  NavBackViewController.m
//  TenThousand
//
//  Created by 我的 on 16/6/30.
//  Copyright © 2016年 baixue. All rights reserved.
//

#import "NavBackViewController.h"

@interface NavBackViewController ()
{
    
        
        void (^_leftClick)();
        void (^_rightClick)();
    
}
@end

@implementation NavBackViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark NavigationBar
-(void)createLeft:(UIImage *)leftimage View:(UIView *)backView leftClick:(NavigationClick)leftClick right:(UIImage *)rightimage rightClick:(NavigationClick)rightClick
{
    backView = [[UIView alloc] initWithFrame:CGRectMake(0, 20, Screen_Width, 44)];
    [self.view addSubview:backView];
    
    if (leftimage) {
        self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithImage: leftimage style:UIBarButtonItemStylePlain target:self action:@selector(leftButtonClick)];
        _leftClick = leftClick;
    }
    if (rightimage) {
        self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithImage:rightimage  style:UIBarButtonItemStylePlain target:self action:@selector(rightButtonClick)];
        _rightClick = rightClick;
    }
}
- (void)leftButtonClick
{
    if (_leftClick) {
        _leftClick();
    }
}
- (void)rightButtonClick
{
    if (_rightClick) {
        _rightClick();
    }
}
@end
